package RedBag;

import java.util.ArrayList;
import java.util.Random;

public class member {
    private String name;
    private int money;

    public member(String name, int money) {
        this.name = name;
        this.money = money;
    }

    public int getMoney() {
        return money;
    }

    public void show(){
        System.out.println("我叫"+name+"抢到"+money+"钱");
    }

    public void setMoney(int money) {
        this.money = money;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public void receive(ArrayList<Integer> list) {
        int index = new Random().nextInt(list.size());
        Integer delta = list.remove(index);
        this.setMoney(this.getMoney() + delta);
    }
}
